
export function formatDate(timestamp) {
    if (typeof timestamp !== 'string' || timestamp.length !== 14) {
        throw new Error('Invalid timestamp format');
    }
 
    // 解析时间戳
    const year = parseInt(timestamp.slice(0, 4), 10);
    const month = parseInt(timestamp.slice(4, 6), 10) - 1; // 月份从0开始计数
    const day = parseInt(timestamp.slice(6, 8), 10);
    const hour = parseInt(timestamp.slice(8, 10), 10);
    const minute = parseInt(timestamp.slice(10, 12), 10);
    const second = parseInt(timestamp.slice(12, 14), 10); // 虽然这里用不到second，但解析是完整的
 
    // 创建一个Date对象
    const date = new Date(year, month, day, hour, minute, second);
 
    // 获取星期（0代表周日，1代表周一，...，6代表周六）
    const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
    const weekday = weekdays[date.getDay()];
 
    // 格式化日期和时间
    const formattedMonth = (month + 1).toString().padStart(2, '0'); // 月份加1并补零
    const formattedDay = day.toString().padStart(2, '0'); // 补零
    const formattedHour = hour.toString().padStart(2, '0'); // 补零
    const formattedMinute = minute.toString().padStart(2, '0'); // 补零
 
    // 拼接成最终的字符串
    return `${year}.${formattedMonth}.${formattedDay} ${weekday} ${formattedHour}:${formattedMinute}`;
}